package com.atguigu.designpattern.simplefactory;

/**
* @program: springcloud
* @description: 操作工厂类
* @author: wangjun
* @create: 2021-05-12
**/
public class OperationFactory {

    public static Operation getOperation(String oper){
        Operation operation = null;
        switch (oper){
            case "+":
                operation = new OperationAdd();
                break;
            case "-":
                operation = new OperationSub();
                break;
            case "*":
                operation = new OperationMul();
                break;
            case "/":
                operation = new OperationDiv();
                break;
        }
        return operation;
    }
}
